package cn.tm.ms.nerver.ft.entry;

/**
 * 模块配置
 * 
 * @author lry
 */
public class ModuleConf {

	//默认的最大重试次数
	public static final int DEFAULT_MAXRETRYNUM=3;
	//默认重试休眠周期,默认不休眠
	public static final long DEFAULT_RETRYCYCLE=10;
	
	//放通率:用于控制后端服务放通的概率,默认1.0表示100%放通,即不做限制
	private double passRate=1.0;
	//最大重试次数
	private int maxRetryNum=0;
	//重试休眠周期,默认不休眠
	private long retryCycle=0;
	//mock服务开关
	private boolean mockEnable=false;
	
	public ModuleConf() {
	}
	
	public ModuleConf(int maxRetryNum, long retryCycle, boolean mockEnable){
		this.maxRetryNum=maxRetryNum;
		this.retryCycle=retryCycle;
		this.mockEnable=mockEnable;
	}
	
	public ModuleConf(double passRate, int maxRetryNum, long retryCycle, boolean mockEnable){
		this.passRate=passRate;
		this.maxRetryNum=maxRetryNum;
		this.retryCycle=retryCycle;
		this.mockEnable=mockEnable;
	}
	
	public double getPassRate() {
		return passRate;
	}

	public void setPassRate(double passRate) {
		this.passRate = passRate;
	}

	public int getMaxRetryNum() {
		return maxRetryNum;
	}
	public void setMaxRetryNum(int maxRetryNum) {
		this.maxRetryNum = maxRetryNum;
	}
	public long getRetryCycle() {
		return retryCycle;
	}
	public void setRetryCycle(long retryCycle) {
		this.retryCycle = retryCycle;
	}

	public boolean isMockEnable() {
		return mockEnable;
	}

	public void setMockEnable(boolean mockEnable) {
		this.mockEnable = mockEnable;
	}

	@Override
	public String toString() {
		return "ModuleConf [passRate=" + passRate + ", maxRetryNum="
				+ maxRetryNum + ", retryCycle=" + retryCycle + ", mockEnable=" + mockEnable + "]";
	}

}
